'use strict'
const db = uniCloud.database()
const dbCmd = db.command
exports.main = async (event, context) => {
	const collection = db.collection('picture_frame')
	
	const limit = parseInt(event.queryStringParameters.limit) || 10
	const page = parseInt(event.queryStringParameters.page) || 1
	const category = event.queryStringParameters.category
	var res = await collection.where({
		category: category
	}).orderBy('addDate', 'desc').skip((page - 1) * limit).limit(limit).get()
	return {
		data: res.data
	}
	// return event
}
